type NameList = {
    name: string
}

export const axios = (url: string): Promise<NameList[]> => {
    return new Promise((resolve, reject) => {
        let xhr = new XMLHttpRequest()

        xhr.open('GET', url)

        xhr.onreadystatechange = () => {
            if (xhr.readyState === 4) {
                if (xhr.status >= 200 && xhr.status < 300) {
                    setTimeout(() => {
                        resolve(JSON.parse(xhr.responseText))
                    }, 1000)
                }
            }
        }

        xhr.send(null)
    })
}